package com.shuoyue.ycgk.ui.recruitment.newsinfo;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.shuoyue.ycgk.R;
import com.shuoyue.ycgk.base.BaseMvpFragment;
import com.shuoyue.ycgk.entity.RecruitmentNotice;
import com.shuoyue.ycgk.utils.MyRichTextHelper;
import com.zzhoujay.richtext.RichText;

import butterknife.BindView;

public class FragmentNoticeInfoNotice extends BaseMvpFragment {

    RecruitmentNotice data;
    @BindView(R.id.title)
    TextView title;
    @BindView(R.id.content)
    TextView content;
    @BindView(R.id.empty)
    ImageView empty;

    public static FragmentNoticeInfoNotice getInstance(RecruitmentNotice notice) {
        FragmentNoticeInfoNotice fragment = new FragmentNoticeInfoNotice();
        Bundle bundle = new Bundle();
        bundle.putSerializable("data", notice);
        fragment.setArguments(bundle);
        return fragment;
    }


    @Override
    public void initParams(Bundle bundle) {
        data = (RecruitmentNotice) bundle.getSerializable("data");

    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_news_info_notice;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {
        super.initData();
        if (data != null) {
            title.setText(data.getTitle());
            MyRichTextHelper.showRich(mContext,data.getContent(),content);

            empty.setVisibility(View.GONE);
        } else {
            empty.setVisibility(View.VISIBLE);
        }
    }

    @Override
    public String getTitle() {
        return "通知公告";
    }
}
